<template>
  <!-- 页面容器 -->
  <div class="dashboard-container">
    <!-- 页面标题 -->
    <div class="page-header">
      <h1 class="page-title">{{ t('pypm.index.title') }}</h1>
      <p class="page-subtitle">{{ t('pypm.index.description') }}</p>
      <el-button 
        type="primary" 
        @click="router.push('/pypm/project')"
        v-hasPermi="['pypm:project:query']"
        class="mt-4"
      >
        <Icon icon="ep:edit" class="mr-2" />
        {{ t('pypm.index.viewAllProjects') }}
      </el-button>
    </div>

    <!-- 统计卡片区域 -->
    <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8">
      <StatCard 
        :title="t('pypm.index.inProgressProjects')" 
        value="12" 
        icon="ep:edit"
        color="primary"
        change="+15%"
        class="card-wrapper"
      />
      <StatCard 
        :title="t('pypm.index.completedProjects')" 
        value="8" 
        icon="ep:circle-check"
        color="success"
        change="+20%"
        class="card-wrapper"
      />
      <StatCard 
        :title="t('pypm.index.upcomingProjects')" 
        value="3" 
        icon="ep:warning"
        color="warning"
        change="-10%"
        class="card-wrapper"
      />
      <StatCard 
        :title="t('pypm.index.totalProjects')" 
        value="20" 
        icon="ep:star"
        color="info"
        change="+12%"
        class="card-wrapper"
      />
    </div>

    <!-- 主要内容区域 -->
    <div class="main-content">
      <!-- 快速操作区域 -->
      <div class="quick-actions card-wrapper">
        <h3 class="quick-actions-title">{{ t('pypm.index.quickAccess') }}</h3>
        <div class="quick-actions-grid">
          <div 
            class="quick-action-btn"
            v-hasPermi="['pypm:project:create']"
            @click="router.push('/pypm/project/create')"
          >
            <Icon icon="ep:circle-plus" class="quick-action-icon" />
            <span class="quick-action-label">{{ t('pypm.index.createProject') }}</span>
          </div>
          <div 
            class="quick-action-btn"
            v-hasPermi="['pypm:task:create']"
            @click="router.push('/pypm/task/create')"
          >
            <Icon icon="ep:edit" class="quick-action-icon" />
            <span class="quick-action-label">{{ t('pypm.index.createTask') }}</span>
          </div>
          <div 
            class="quick-action-btn"
            v-hasPermi="['pypm:projectmember:query']"
            @click="router.push('/pypm/projectmember')"
          >
            <Icon icon="ep:user" class="quick-action-icon" />
            <span class="quick-action-label">{{ t('pypm.index.projectMembers') }}</span>
          </div>
          <div 
            class="quick-action-btn"
            v-hasPermi="['pypm:projectmilestone:query']"
            @click="router.push('/pypm/projectmilestone')"
          >
            <Icon icon="ep:star" class="quick-action-icon" />
            <span class="quick-action-label">{{ t('pypm.index.milestones') }}</span>
          </div>
        </div>
      </div>

      <!-- 内容卡片区 -->
      <div class="content-section">
        <!-- 我的项目 -->
        <el-card class="card-wrapper modern-card">
          <template #header>
            <div class="card-header modern-header">
              <div class="header-content">
                <h3 class="card-title">{{ t('pypm.index.myProjects') }}</h3>
                <div class="header-selector">
                  <el-select 
                    v-model="projectFilter"
                    :placeholder="t('pypm.index.filterProjects')"
                    size="small"
                    class="modern-select"
                  >
                    <el-option :label="t('common.all')" value="all" />
                    <el-option :label="t('pypm.index.inProgress')" value="inProgress" />
                    <el-option :label="t('pypm.index.completed')" value="completed" />
                    <el-option :label="t('pypm.index.paused')" value="paused" />
                  </el-select>
                </div>
              </div>
            </div>
          </template>
          
          <div class="project-list">
            <div 
              v-for="project in myProjects" 
              :key="project.id"
              class="project-card"
              @click="router.push({ path: '/pypm/project/detail', query: { id: project.id } })"
            >
              <div class="project-header">
                <h4 class="project-name">{{ project.name }}</h4>
                <el-tag 
                  :type="getStateTagType(project.state)"
                  effect="light"
                >
                  {{ project.state }}
                </el-tag>
              </div>
              <p class="project-desc">{{ project.description }}</p>
              <div class="project-meta">
                <span class="project-manager">
                  <Icon icon="ep:user" class="mr-1" size="14" />
                  {{ project.creator }}
                </span>
                <span class="project-date">
                  <Icon icon="ep:calendar" class="mr-1" size="14" />
                  {{ formatDate(project.startDate) }} - {{ formatDate(project.endDate) }}
                </span>
              </div>
              <div class="project-progress">
                <div 
                  class="progress-bar" 
                  :style="{ width: getProjectProgress(project.state) }"
                ></div>
              </div>
            </div>
          </div>
          
          <div class="flex justify-end mt-4">
            <a 
              href="javascript:void(0)"
              @click="router.push('/pypm/project')"
              class="view-all-link"
            >
              {{ t('pypm.index.viewAll') }}
              <Icon icon="ep:arrow-right" class="ml-1" />
            </a>
          </div>
        </el-card>

        <!-- 近期任务 -->
        <el-card class="card-wrapper modern-card">
          <template #header>
            <div class="card-header modern-header">
              <div class="header-content">
                <h3 class="card-title">{{ t('pypm.index.recentTasks') }}</h3>
                <div class="header-selector">
                  <el-select 
                    v-model="taskFilter"
                    :placeholder="t('pypm.index.filterTasks')"
                    size="small"
                    class="modern-select"
                  >
                    <el-option :label="t('common.all')" value="all" />
                    <el-option :label="t('pypm.index.pending')" value="pending" />
                    <el-option :label="t('pypm.index.inProgress')" value="inProgress" />
                    <el-option :label="t('pypm.index.completed')" value="completed" />
                  </el-select>
                </div>
              </div>
            </div>
          </template>
          
          <div v-if="recentTasks.length > 0" class="task-list">
            <div 
              v-for="task in recentTasks" 
              :key="task.id"
              class="task-item modern-task-item"
              @click="viewTask(task.id)"
            >
              <div class="flex items-start">
                <div class="flex-shrink-0 mr-4">
                  <div 
                    class="w-10 h-10 rounded-full flex items-center justify-center text-white shadow-sm"
                    :style="{ backgroundColor: getTaskColor(task.priority) }"
                  >
                    <Icon :icon="getTaskIcon(task.status)" :size="18" />
                  </div>
                </div>
                <div class="flex-grow">
                  <div class="task-header">
                    <h4 class="font-medium text-gray-800">{{ task.name }}</h4>
                    <span class="task-priority-dot" :style="{ backgroundColor: getTaskColor(task.priority) }"></span>
                  </div>
                  <div class="task-meta">
                    <span class="task-project">{{ task.projectName }}</span>
                    <span class="task-deadline">
                      <Icon icon="ep:calendar" class="mr-1" size="12" />
                      {{ formatDate(task.endTime) }}
                    </span>
                  </div>
                  <div class="task-status-badge" :class="`task-status-${task.status}`">
                    {{ task.status }}
                  </div>
                </div>
              </div>
            </div>
          </div>
          <div v-else class="py-12 text-center text-gray-500">
            <div class="inline-flex items-center justify-center w-16 h-16 rounded-full bg-gray-100 mb-4">
              <Icon icon="ep:circle-plus" :size="32" />
            </div>
            <p>{{ t('pypm.index.noRecentTasks') }}</p>
          </div>
          
          <div class="flex justify-end mt-4">
            <a 
              href="javascript:void(0)"
              @click="router.push('/pypm/task')"
              class="view-all-link"
            >
              {{ t('pypm.index.viewAll') }}
              <Icon icon="ep:arrow-right" class="ml-1" />
            </a>
          </div>
        </el-card>

        <!-- 项目活动日志 -->
        <el-card class="card-wrapper modern-card">
          <template #header>
            <div class="card-header">
              <h3 class="card-title">{{ t('pypm.index.projectActivities') }}</h3>
            </div>
          </template>
          
          <div v-if="projectActivities.length > 0" class="activity-timeline modern-timeline">
            <div 
              v-for="(activity) in projectActivities" 
              :key="activity.id"
              class="activity-item modern-activity-item"
            >
              <div class="activity-icon">
                <div class="activity-icon-bg" :class="`activity-${activity.actionType}`">
                  <Icon :icon="getActivityIcon(activity.actionType)" size="16" />
                </div>
              </div>
              <div class="activity-content">
                <div class="activity-time">{{ formatDateTime(activity.createTime) }}</div>
                <div class="activity-description">{{ activity.description }}</div>
              </div>
            </div>
          </div>
          <div v-else class="py-12 text-center text-gray-500">
            <div class="inline-flex items-center justify-center w-16 h-16 rounded-full bg-gray-100 mb-4">
              <Icon icon="ep:circle-plus" :size="32" />
            </div>
            <p>{{ t('pypm.index.noActivityRecords') }}</p>
          </div>
        </el-card>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue'
import { useRouter } from 'vue-router'
import { useI18n } from 'vue-i18n'
import { Icon } from '@/components/Icon/index'
import StatCard from './StatCard.vue'

const router = useRouter()
const { t } = useI18n()

// 筛选条件
const projectFilter = ref('all')
const taskFilter = ref('all')

// 加载状态
const projectsLoading = ref(false)

// 项目接口定义
interface ProjectVO {
  id: number
  name: string
  description: string
  state: string
  startDate: string
  endDate: string
  creator: string
}

// 任务接口定义
interface TaskVO {
  id: number
  name: string
  projectName: string
  status: string
  priority: string
  endTime: string
}

// 活动接口定义
interface ActivityVO {
  id: number
  description: string
  actionType: string
  createTime: string
}

// 模拟项目数据
const myProjects: ProjectVO[] = [
  {
    id: 1,
    name: '产品开发平台',
    description: '企业级产品开发平台升级项目',
    state: '进行中',
    startDate: '2023-07-15',
    endDate: '2023-12-15',
    creator: '张三'
  },
  {
    id: 2,
    name: '数据分析系统',
    description: '大数据分析与可视化系统建设',
    state: '进行中',
    startDate: '2023-08-01',
    endDate: '2023-11-30',
    creator: '李四'
  },
  {
    id: 3,
    name: '客户管理系统',
    description: 'CRM系统升级与功能扩展',
    state: '已完成',
    startDate: '2023-05-01',
    endDate: '2023-09-30',
    creator: '王五'
  },
  {
    id: 4,
    name: '人力资源管理',
    description: 'HRM系统重构与优化',
    state: '暂停中',
    startDate: '2023-06-10',
    endDate: '2024-01-10',
    creator: '赵六'
  }
]

// 模拟任务数据
const recentTasks: TaskVO[] = [
  {
    id: 1,
    name: '需求分析文档编写',
    projectName: '产品开发平台',
    status: '进行中',
    priority: 'high',
    endTime: '2023-10-15'
  },
  {
    id: 2,
    name: '数据库设计评审',
    projectName: '数据分析系统',
    status: '待处理',
    priority: 'medium',
    endTime: '2023-10-10'
  },
  {
    id: 3,
    name: '用户界面原型设计',
    projectName: '产品开发平台',
    status: '已完成',
    priority: 'high',
    endTime: '2023-09-30'
  },
  {
    id: 4,
    name: 'API接口文档更新',
    projectName: '客户管理系统',
    status: '进行中',
    priority: 'low',
    endTime: '2023-10-20'
  }
]

// 模拟活动数据
const projectActivities: ActivityVO[] = [
  {
    id: 1,
    description: '张三创建了项目「产品开发平台」',
    actionType: 'create',
    createTime: '2023-10-05 14:30:00'
  },
  {
    id: 2,
    description: '李四更新了任务「数据库设计评审」的状态为待处理',
    actionType: 'update',
    createTime: '2023-10-04 10:15:00'
  },
  {
    id: 3,
    description: '王五完成了任务「用户界面原型设计」',
    actionType: 'complete',
    createTime: '2023-09-30 16:45:00'
  },
  {
    id: 4,
    description: '赵六添加了项目成员「钱七」到「人力资源管理」',
    actionType: 'add',
    createTime: '2023-09-28 09:20:00'
  }
]

// 获取项目状态对应的标签类型
const getStateTagType = (state: string): string => {
  const typeMap: Record<string, string> = {
    '进行中': 'primary',
    '已完成': 'success',
    '暂停中': 'warning',
    '计划中': 'info'
  }
  return typeMap[state] || 'default'
}

// 获取任务状态对应的图标
const getTaskIcon = (status: string): string => {
  const iconMap: Record<string, string> = {
    '待处理': 'ep:clock',
    '进行中': 'ep:loading',
    '已完成': 'ep:circle-check',
    '已暂停': 'ep:pause'
  }
  return iconMap[status] || 'ep:question'
}

// 获取项目进度
const getProjectProgress = (state: string): string => {
  const progressMap: Record<string, string> = {
    '进行中': '65%',
    '已完成': '100%',
    '暂停中': '30%',
    '计划中': '10%'
  }
  return progressMap[state] || '0%'
}

// 获取任务优先级对应的颜色
const getTaskColor = (priority: string): string => {
  const colorMap: Record<string, string> = {
    'high': '#ff4d4f',
    'medium': '#faad14',
    'low': '#1890ff'
  }
  return colorMap[priority] || '#8c8c8c'
}

// 获取活动类型对应的图标
const getActivityIcon = (actionType: string): string => {
  const iconMap: Record<string, string> = {
    'create': 'ep:plus',
    'update': 'ep:edit',
    'delete': 'ep:delete',
    'complete': 'ep:success',
    'add': 'ep:user-plus',
    'remove': 'ep:user-delete'
  }
  return iconMap[actionType] || 'ep:circle-plus'
}

// 格式化日期
const formatDate = (dateString: string): string => {
  // 简化的日期格式化，实际项目中可能需要更复杂的处理
  return dateString
}

// 格式化日期时间
const formatDateTime = (dateTimeString: string): string => {
  // 简化的日期时间格式化，实际项目中可能需要更复杂的处理
  return dateTimeString
}

// 查看任务详情
const viewTask = (taskId: number): void => {
  router.push({ path: '/pypm/task/detail', query: { id: taskId } })
}
</script>

<style lang="scss" scoped>
// 现代化设计系统变量
$primary-color: #1890ff;
$primary-light: #40a9ff;
$primary-dark: #096dd9;
$success-color: #52c41a;
$warning-color: #faad14;
$error-color: #ff4d4f;
$text-primary: #262626;
$text-secondary: #595959;
$text-tertiary: #8c8c8c;
$border-color: #f0f0f0;
$bg-light: #fafafa;
$shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
$shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
$shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
$transition-base: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
$border-radius-sm: 6px;
$border-radius-md: 8px;
$border-radius-lg: 12px;

// 主布局样式
.dashboard-container {
  min-height: 100vh;
  background-color: $bg-light;
  padding: 24px;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(24, 144, 255, 0.02) 0%, transparent 20%),
    radial-gradient(circle at 90% 60%, rgba(250, 173, 20, 0.02) 0%, transparent 25%);
}

// 页面标题样式
.page-header {
  margin-bottom: 24px;
  animation: fadeInUp 0.6s ease-out;
}

.page-title {
  font-size: 28px;
  font-weight: 600;
  color: $text-primary;
  margin-bottom: 8px;
}

.page-subtitle {
  font-size: 14px;
  color: $text-tertiary;
}

// 主要内容区域
.main-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-bottom: 24px;
}

// 快速操作区域
.quick-actions {
  grid-column: 1 / -1;
  margin-bottom: 24px;
}

.quick-actions-title {
  font-size: 16px;
  font-weight: 500;
  color: $text-primary;
  margin-bottom: 16px;
}

.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}

// 内容卡片区
.content-section {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
}

// 卡片通用样式
.card-wrapper {
  animation: fadeInUp 0.6s ease-out;
  transition: $transition-base;
  &:nth-child(2) { animation-delay: 0.1s; }
  &:nth-child(3) { animation-delay: 0.2s; }
  &:nth-child(4) { animation-delay: 0.3s; }
}

// 现代卡片样式
.modern-card {
  position: relative;
  overflow: hidden;
  
  &::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, $primary-color, $primary-light);
    opacity: 0;
    transition: $transition-base;
  }
  
  &:hover {
    box-shadow: $shadow-lg;
    transform: translateY(-2px);
    
    &::before {
      opacity: 1;
    }
  }
}

// 卡片标题样式
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

// 现代化头部样式
.modern-header {
  padding: 0 8px;
}

.header-content {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.header-selector {
  display: flex;
  align-items: center;
}

.card-title {
  font-size: 18px;
  font-weight: 600;
  color: $text-primary;
  margin: 0;
  position: relative;
  display: inline-block;
  padding-bottom: 4px;

  &::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 30px;
    height: 3px;
    background: $primary-color;
    border-radius: 3px;
  }
}

// 现代化选择器样式
.modern-select {
  min-width: 140px;
  transition: $transition-base;
  border-radius: $border-radius-md;
  border-color: $border-color;

  .el-input__inner {
    border-radius: $border-radius-md;
    height: 32px;
    line-height: 32px;
    font-size: 14px;
    color: $text-secondary;
    background-color: #fff;
    border: 1px solid $border-color;
    transition: $transition-base;

    &:focus {
      border-color: $primary-light;
      box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
    }
  }

  &:hover .el-input__inner {
    border-color: $primary-light;
  }
}

.view-all-link {
  display: flex;
  align-items: center;
  font-size: 14px;
  color: $primary-color;
  transition: $transition-base;
  text-decoration: none;
  
  &:hover {
    color: $primary-dark;
    transform: translateX(2px);
  }
}

// 统计卡片样式增强
.stat-card {
  border-radius: $border-radius-lg;
  background-color: white;
  padding: 24px;
  box-shadow: $shadow-sm;
  transition: $transition-base;
  position: relative;
  overflow: hidden;
  border: 1px solid $border-color;
  
  &::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 120px;
    height: 120px;
    background: linear-gradient(135deg, rgba(24, 144, 255, 0.1), rgba(24, 144, 255, 0));
    border-radius: 50%;
    transform: translate(50%, -50%);
  }
  
  &:hover {
    box-shadow: $shadow-md;
    transform: translateY(-2px);
    border-color: $primary-light;
  }
  
  .stat-icon {
    font-size: 32px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(24, 144, 255, 0.1), rgba(24, 144, 255, 0.05));
    color: $primary-color;
    transition: $transition-base;
    
    &:hover {
      transform: scale(1.1);
      box-shadow: 0 0 20px rgba(24, 144, 255, 0.2);
    }
  }
  
  .stat-value {
    font-size: 32px;
    font-weight: 600;
    color: $text-primary;
    margin-bottom: 4px;
    line-height: 1;
  }
  
  .stat-label {
    font-size: 14px;
    color: $text-tertiary;
    margin-bottom: 8px;
  }
  
  .stat-change {
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
  }
  
  .stat-change.positive {
    color: $success-color;
  }
  
  .stat-change.negative {
    color: $error-color;
  }
}

// 快速操作按钮样式
.quick-action-btn {
  position: relative;
  overflow: hidden;
  transition: $transition-base;
  border: 1px solid $border-color;
  background: white;
  border-radius: $border-radius-md;
  padding: 20px 16px;
  text-align: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  
  &:hover {
    transform: translateY(-2px);
    box-shadow: $shadow-md;
    border-color: $primary-light;
  }
  
  .quick-action-icon {
    font-size: 28px;
    color: $primary-color;
    margin-bottom: 8px;
    transition: $transition-base;
    
    &:hover {
      transform: scale(1.1) rotate(5deg);
    }
  }
  
  .quick-action-label {
    font-size: 14px;
    font-weight: 500;
    color: $text-primary;
  }
  
  &::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(24, 144, 255, 0.1), transparent);
    transition: all 0.6s ease;
  }
  
  &:hover::after {
    left: 100%;
  }
}

// 任务列表样式
.task-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.task-item {
  position: relative;
  background: white;
  border-radius: $border-radius-md;
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid $border-color;
  transition: $transition-base;
  cursor: pointer;
}

// 现代任务项样式
.modern-task-item {
  background: white;
  border-radius: $border-radius-md;
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid $border-color;
  transition: $transition-base;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  
  &::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background-color: transparent;
    transition: $transition-base;
  }
  
  &:hover {
    transform: translateY(-2px);
    box-shadow: $shadow-md;
    border-color: $primary-light;
    
    &::after {
      background-color: $primary-color;
    }
  }
  
  .task-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
  }
  
  .task-priority-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
  }
  
  .task-meta {
    display: flex;
    gap: 16px;
    margin-bottom: 8px;
    
    .task-project {
      font-size: 13px;
      color: $text-secondary;
    }
    
    .task-deadline {
      font-size: 13px;
      color: $text-tertiary;
      display: flex;
      align-items: center;
    }
  }
  
  .task-status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
  }
  
  .task-status-待处理 {
    background-color: rgba(250, 173, 20, 0.1);
    color: $warning-color;
  }
  
  .task-status-进行中 {
    background-color: rgba(24, 144, 255, 0.1);
    color: $primary-color;
  }
  
  .task-status-已完成 {
    background-color: rgba(82, 196, 26, 0.1);
    color: $success-color;
  }
}

// 活动日志时间轴样式
.activity-timeline {
  position: relative;
  padding-left: 40px;
}

// 现代活动时间轴样式
.modern-timeline {
  position: relative;
  padding-left: 0;
}

.modern-activity-item {
  display: flex;
  gap: 16px;
  padding-bottom: 24px;
  position: relative;
  
  &:last-child {
    padding-bottom: 0;
  }
  
  &::before {
    content: '';
    position: absolute;
    left: 19px;
    top: 28px;
    width: 2px;
    background-color: $border-color;
    height: calc(100% - 28px);
  }
  
  &:last-child::before {
    display: none;
  }
  
  .activity-icon {
    flex-shrink: 0;
  }
  
  .activity-icon-bg {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    
    &.activity-create {
      background-color: $primary-color;
    }
    
    &.activity-update {
      background-color: $warning-color;
    }
    
    &.activity-delete {
      background-color: $error-color;
    }
    
    &.activity-complete {
      background-color: $success-color;
    }
    
    &.activity-add {
      background-color: #722ed1;
    }
    
    &.activity-remove {
      background-color: #fa8c16;
    }
  }
  
  .activity-content {
    flex: 1;
    padding-top: 6px;
  }
  
  .activity-time {
    font-size: 12px;
    color: $text-tertiary;
    margin-bottom: 4px;
  }
  
  .activity-description {
    font-size: 14px;
    color: $text-secondary;
    line-height: 1.5;
  }
}

// 项目列表样式
.project-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.project-card {
  background: white;
  border-radius: $border-radius-md;
  padding: 16px;
  border: 1px solid $border-color;
  transition: $transition-base;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  
  &::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background-color: transparent;
    transition: $transition-base;
  }
  
  &:hover {
    box-shadow: $shadow-md;
    transform: translateY(-2px);
    border-color: $primary-light;
    
    &::before {
      background-color: $primary-color;
    }
  }
  
  .project-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
  }
  
  .project-name {
    font-size: 16px;
    font-weight: 500;
    color: $text-primary;
    margin: 0;
    flex: 1;
    margin-right: 12px;
  }
  
  .project-desc {
    font-size: 14px;
    color: $text-secondary;
    margin-bottom: 12px;
    line-height: 1.5;
  }
  
  .project-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    
    .project-manager,
    .project-date {
      font-size: 13px;
      color: $text-tertiary;
      display: flex;
      align-items: center;
    }
  }
  
  .project-progress {
    width: 100%;
    height: 6px;
    background-color: $border-color;
    border-radius: 3px;
    overflow: hidden;
    
    .progress-bar {
      height: 100%;
      background: linear-gradient(90deg, $primary-light, $primary-color);
      border-radius: 3px;
      transition: width 1s ease-in-out;
    }
  }
}

// 按钮样式增强
:deep(.el-button) {
  border-radius: $border-radius-md !important;
  transition: $transition-base !important;
  font-weight: 500;
  font-size: 14px;
  
  &:focus {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(24, 144, 255, 0.3) !important;
  }
  
  &:hover:not(:disabled) {
    transform: translateY(-1px);
  }
}

:deep(.el-button--primary) {
  background: linear-gradient(135deg, $primary-color 0%, $primary-light 100%);
  border: none;
  box-shadow: 0 2px 8px rgba(24, 144, 255, 0.2);
  
  &:hover:not(:disabled) {
    background: linear-gradient(135deg, $primary-dark 0%, $primary-color 100%);
    box-shadow: 0 4px 12px rgba(24, 144, 255, 0.3);
  }
}

:deep(.el-button--primary.is-plain) {
  border-width: 1px;
  background-color: rgba(24, 144, 255, 0.05);
}

// 标签样式增强
:deep(.el-tag) {
  border-radius: 12px;
  padding: 2px 10px;
  height: auto;
  font-size: 12px;
  transition: $transition-base;
  
  &:hover {
    transform: scale(1.05);
  }
}

// 选择框样式增强
:deep(.el-select) {
  &:hover .el-input__wrapper {
    box-shadow: $shadow-sm;
  }
  
  .el-input__wrapper {
    border-radius: $border-radius-md !important;
    transition: $transition-base;
    border: 1px solid $border-color;
  }
  
  &.is-focus .el-input__wrapper {
    border-color: $primary-light !important;
    box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2) !important;
  }
}

// 卡片样式增强
:deep(.el-card) {
  border-radius: $border-radius-lg !important;
  border: 1px solid $border-color !important;
  box-shadow: $shadow-sm;
  transition: $transition-base;
  
  &:hover {
    box-shadow: $shadow-md;
  }
  
  .el-card__body {
    padding: 24px !important;
  }
}

// 响应式设计优化
@media screen and (max-width: 1200px) {
  .main-content {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
  }
  
  .content-section {
    gap: 20px;
  }
}

@media screen and (max-width: 768px) {
  .dashboard-container {
    padding: 16px;
  }
  
  .page-title {
    font-size: 24px;
  }
  
  .main-content {
    gap: 16px;
  }
  
  .quick-actions-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
  }
  
  .content-section {
    gap: 16px;
  }
  
  .stat-card {
    padding: 20px 16px;
    
    .stat-value {
      font-size: 28px;
    }
  }
  
  :deep(.el-card__body) {
    padding: 20px 16px !important;
  }
}

@media screen and (max-width: 480px) {
  .dashboard-container {
    padding: 12px;
  }
  
  .quick-actions-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .project-grid {
    grid-template-columns: 1fr;
  }
}

// 动画效果
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

// 骨架屏样式
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 1000px 100%;
  animation: shimmer 1.5s infinite linear;
  border-radius: $border-radius-sm;
}

// 加载动画
.loading {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 2px solid rgba(24, 144, 255, 0.1);
  border-radius: 50%;
  border-top-color: $primary-color;
  animation: spin 1s ease-in-out infinite;
}

// 滚动条样式美化
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb {
  background: #d9d9d9;
  border-radius: 3px;
  
  &:hover {
    background: #bfbfbf;
  }
}
</style>
